package cn.enjoy.tool.utils;

import org.springframework.util.Assert;

import java.io.File;

/**
 * @author K
 * @date 2020/11/17 14:46
 */
public class FileUtil extends org.springframework.util.FileCopyUtils {

    /**
     * 获取文件后缀名
     * @param fullName 文件全名
     * @return {String}
     */
    public static String getFileExtension(String fullName) {
        Assert.notNull(fullName, "file fullName is null.");
        String fileName = new File(fullName).getName();
        int dotIndex = fileName.lastIndexOf('.');
        return (dotIndex == -1) ? "" : fileName.substring(dotIndex + 1);
    }

}
